// 加载元素控件
var table;
//获取 选中楼宇id   商圈id
var BUILDING_ID = QueryUtils.GetQueryString("activebuildingID");
var BUSINESS_ID = QueryUtils.GetQueryString("activebusinessID");
var $;
layui.use(['jquery', 'element', 'layer', 'laydate', 'form', 'table'], function () {
    $ = layui.jquery, element = layui.element, layer = layui.layer, form = layui.form, table = layui.table, laydate = layui.laydate;
    //获取当前月
    var date_ = new Date();
    var year = date_.getFullYear();
    var month = date_.getMonth() + 1;
    var paystar = year + '-' + month + '-01'
    var day = new Date(year, month, 0);
    var payend = year + '-' + month + '-' + day.getDate();

    //（1）收租列表
    //加载待处理账单
    var data = {};
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data.paystar = paystar;
    data.payend = payend;
    //默认显示时间
    //应收
    $("#START_DATEw").val(paystar);
    $("#END_DATEw").val(payend)

    //已收
    $("#START_DATE").val(paystar);
    $("#END_DATE").val(payend)



    //应付
    $("#START_DATEyf").val(paystar);
    $("#END_DATEyf").val(payend)

    //逾期
    $("#START_DATEy").val(paystar);
    $("#END_DATEy").val(payend);

    //逾期
    $("#START_DATEziy").val(paystar);
    $("#END_DATEziy").val(payend);




    //初始化时间
    laydate.render({
        elem: '#START_DATE'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEw'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATE'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEw'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEsy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEsy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEzc'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEzc'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEsyys'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEsyys'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEziy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEziy'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEyf'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEyf'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEtzjs'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEtzjs'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#END_DATEspzd'
        , format: 'yyyy-MM-dd'
    });
    laydate.render({
        elem: '#START_DATEspzd'
        , format: 'yyyy-MM-dd'
    });


    var tabselect;
    //收费列表
    element.on('tab(toll_list)', function (data1) {
        //加载已处理账单  已收
        tabselect = $(this).data("szlx");
        switch (tabselect){
            case 2:
                data.START_DATE=$("#START_DATE").val();
                data.END_DATE=$("#END_DATE").val();
                table.render({
                    elem: '#yichuli'
                    , url: '/billController/listPayOk'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        /*, {field: 'STATE', event: 'setSign', title: '账单状态', width: 120}*/
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '应收金额', width: 120, align: 'right',sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
                        , {field: 'PAY_PRICE', event: 'setSign', title: '实收金额', width: 120, align: 'right',sort: 'true'}
                        , {field: 'ACT_PAY_DATE', event: 'setSign', title: '实收日期', width: 120, sort: 'true'}
                        , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'IF_COLLECTION', event: 'setSign', title: '自动扣款', align: 'center', width: 120, sort: 'true'}
                        , {field: 'COLLECTION_STATE', event: 'setSign', title: '扣款状态', align: 'center', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120}
                        , {fixed: 'right', width: 160, align: 'center', title: '操作', toolbar: '#yclbar'}

                    ]]
                    , id: 'yclID'
                    , page: true
                    , height: 470
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].PAY_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单实收金额汇总：' + total.toFixed(2)+'元</span></span>');

                    }
                });
                break;
            case 3:
                //加载应付 账单
                table.render({
                    elem: '#yingfu'
                    , url: '/billController/listyingfu'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        /*, {field: 'STATE', event: 'setSign', title: '账单状态', width: 120}*/
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '应付金额', width: 120,align: 'right', sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
                        /* , {field: 'PAY_PRICE', event: 'setSign', title: '实收金额', width: 120,align: 'right', sort: 'true'}
                         , {field: 'ACT_PAY_DATE', event: 'setSign', title: '实收日期', width: 120, sort: 'true'}*/
                        , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120}
                        , {fixed: 'right', width: 160, align: 'center', title: '操作', toolbar: '#yingfubar'}

                    ]]
                    , id: 'yingfuID'
                    , page: true
                    , height: 470
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单应付金额汇总：' + total.toFixed(2)+'元</span></span>');

                    }
                });
                break;
            case 4:
                //加载逾期账单
                table.render({
                    elem: '#yuqi'
                    , url: '/billController/listPayyuqi'
                    , where: data
                    , cols: [[
                        {checkbox: true, LAY_CHECKED: true} //默认全选
                        , {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '账单金额', width: 120, align: 'right',sort: 'true'}
                        , {field: 'LATE_DAY', event: 'setSign', title: '逾期天数', width: 120, sort: 'true'}
                        , {field: 'LATE_FEE', event: 'setSign', title: '滞纳金(元)', width: 120, align: 'right',sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
                        , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120}
                        , {fixed: 'right', width: 200, align: 'center', title: '操作', toolbar: '#yqbar'}

                    ]]
                    , id: 'yqlbID'
                    , page: true
                    , height: 470
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单逾期金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;
            case 5:
                //加载自用账单
                table.render({
                    elem: '#ziyong'
                    , url: '/billController/listPayziyong'
                    , where: data
                    , cols: [[
                        /* {checkbox: true, LAY_CHECKED: true} //默认全选*/
                        /*,{field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '房号', width: 120}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120}*/
                        {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '账单金额', width: 120,align: 'right', sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        /* , {field: 'PRICE_TYPE', event: 'setSign', title: '账单状态', align: 'center',width: 120}*/
                        , {field: 'NAME', event: 'setSign', title: '操作人', width: 120, sort: 'true'}
                        , {field: 'CREATE_DATE', event: 'setSign', title: '操作时间', width: 170, sort: 'true'}
                        , {fixed: 'right', width: 160, align: 'center', title: '操作', toolbar: '#ziyongbar'}

                    ]]
                    , id: 'ZIYONG'
                    , page: true
                    , height: 470
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;


        }
    });
    //流水明细
    element.on('tab(lsmx)', function (data2) {
        //加载已处理账单  已收
        tabselect = $(this).data("lsmx");
        switch (tabselect){
            case 0:
                //（2）留水明细
                //加载收入列表
                table.render({
                    elem: '#srtable'
                    , url: '/billController/listshouru'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'COLLECTION_TYPE', event: 'setSign', title: '收款账户', width: 120, sort: 'true'}
                        , {field: 'ACT_PAY_DATE', event: 'setSign', title: '实收日期', width: 120, sort: 'true'}
                        , {field: 'PAY_METHOD', event: 'setSign', title: '支付方式', width: 140, sort: 'true'}
                        , {field: 'PAY_PRICE', event: 'setSign', title: '支付金额', width: 120,align: 'right', sort: 'true'}
                        , {field: 'PAY_TRANSACTION', event: 'setSign', title: '流水号', width: 140, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        , {fixed: 'right',  event: 'setSign', align: 'center',title: '操作', toolbar: '#lsmxbar', width: 160}

                    ]]
                    , id: 'shouruID'
                    , page: true
                    , height: '470'
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].PAY_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;
            case 1:
                //加载支付列表
                table.render({
                    elem: '#zctable'
                    , url: '/billController/listzhichu'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'COLLECTION_TYPE', event: 'setSign', title: '收款账户', width: 120, sort: 'true'}
                        , {field: 'ACT_PAY_DATE', event: 'setSign', title: '实收日期', width: 120, sort: 'true'}
                        , {field: 'PAY_METHOD', event: 'setSign', title: '支付方式', width: 120, sort: 'true'}
                        , {field: 'PAY_PRICE', event: 'setSign', title: '支付金额', width: 120, align: 'right',sort: 'true'}
                        , {field: 'PAY_TRANSACTION', event: 'setSign', title: '流水号', width: 120, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        , {fixed: 'right',  event: 'setSign',align: 'center', title: '操作', toolbar: '#zcbar', width: 160}

                    ]]
                    , id: 'zhichuID'
                    , page: true
                    , height: 470
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].PAY_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;

        }
    });
    //收入预算 退租结算 审批账单
    element.on('tab(expense_management)', function (data1) {
        tabselect = $(this).data("2tab");
        switch (tabselect){
            case 2:
                //收入预算
                table.render({
                    elem: '#srys'
                    , url: '/billController/listshouruyusuan'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '应收费用', width: 120,align: 'right', sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
                        , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'END_DATE', event: 'setSign', title: '付租截至时间', width: 120, sort: 'true'}
                        , {field: 'jzts', event: 'setSign', title: '距离截至天数', width: 120, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        , {fixed: 'right', event: 'setSign',align: 'center', title: '操作', toolbar: '#srysbar', width: 160}

                    ]]
                    , id: 'shouruyusuanID'
                    , page: true
                    , height: '530'
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;
            case 3:
                //退租结算
                table.render({
                    elem: '#tzjs'
                    , url: '/billController/listtzjs'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'PAY_DATE', event: 'setSign', title: '退租日期', width: 120, sort: 'true'}
                        , {field: 'BILL_STATE', event: 'setSign', title: '状态', width: 120, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '应收费用', width: 120, align: 'right',sort: 'true'}
                        // , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', width: 120, sort: 'true'}
                        , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120}
                        , {fixed: 'right',  event: 'setSign', align: 'center',title: '操作', toolbar: '#tzjsbar', width: 160}

                    ]]
                    , id: 'tzjsid'
                    , page: true
                    , height: '530'
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;
            case 4:
                //加载 审批账单 table
                table.render({
                    elem: '#spzd'
                    , url: '/billController/billshenpi'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'TOTAL_PRICE', event: 'setSign', title: '账单金额', width: 120, align: 'right',sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        , {field: 'CREATE_ID', event: 'setSign', title: '提交人', width: 120}
                        , {field: 'CREATE_DATE', event: 'setSign', title: '提交时间', width: 180}
                        , {field: 'STATE', event: 'setSign', title: '状态', width: 120, sort: 'true'}
                        , {
                            fixed: 'right',
                            event: 'setSign',
                            title: '操作',
                            align: 'center',
                            toolbar: '#shenpibar',
                            width: 120,
                            templet: '#shenpiTpl'
                        }

                    ]]
                    , id: 'shenpiID'
                    , page: true
                    , height: '568'
                    , limit: '10'
                    , done: function(res, curr, count){
                        var total=0;
                        for(var i=0;i<res.data.length;i++){
                            total+=parseFloat(res.data[i].TOTAL_PRICE);
                        }
                        $(".total_price").remove();
                        $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                    }
                });
                break;
            case 1:
                //加载流水明细
             table.render({
                    elem: '#srtable'
                    , url: '/billController/listshouru'
                    , where: data
                    , cols: [[
                        {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
                        , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 120, sort: 'true'}
                        , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
                        , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
                        , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
                        , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
                        , {field: 'COLLECTION_TYPE', event: 'setSign', title: '收款账户', width: 120, sort: 'true'}
                        , {field: 'ACT_PAY_DATE', event: 'setSign', title: '实收日期', width: 120, sort: 'true'}
                        , {field: 'PAY_METHOD', event: 'setSign', title: '支付方式', width: 140, sort: 'true'}
                        , {field: 'PAY_PRICE', event: 'setSign', title: '支付金额', width: 120,align: 'right', sort: 'true'}
                        , {field: 'PAY_TRANSACTION', event: 'setSign', title: '流水号', width: 140, sort: 'true'}
                        , {field: 'INFO', event: 'setSign', title: '备注', width: 120, sort: 'true'}
                        , {fixed: 'right',  event: 'setSign',align: 'center', title: '操作', toolbar: '#lsmxbar', width: 160}

                    ]]
                    , id: 'shouruID'
                    , page: true
                    , height: '470'
                    , limit: '10'
                    , done: function(res, curr, count){
                     var total=0;
                     for(var i=0;i<res.data.length;i++){
                         console.log(res.data[i].PAY_PRICE)
                         total+=parseFloat(res.data[i].PAY_PRICE);
                     }
                     $(".total_price").remove();
                     $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');
                 }
                });
                break;
        }
    });
    //加载应收列表
    table.render({
        elem: '#szlb'
        , url: '/billController/json'
        , where: data
        , cols: [[
            {checkbox: true, LAY_CHECKED: true} //默认全选
            , {field: 'BUILDING_NAME', event: 'setSign', title: '楼宇名称', width: 160, sort: 'true'}
            , {field: 'ROOM_NUM', event: 'setSign', title: '项目编号', width: 160, sort: 'true', templet: '#weishouTpl'}
            , {field: 'COMPANY_NAME', event: 'setSign', title: '承租方', width: 120, sort: 'true'}
            , {field: 'BYNAME', event: 'setSign', title: '别名', width: 120, sort: 'true'}
            , {field: 'SIGNER_TEL', event: 'setSign', title: '联系方式', width: 120, sort: 'true'}
            , {field: 'START_DATE', event: 'setSign', title: '账单周期', width: 200, sort: 'true'}
            , {field: 'BILL_NAME', event: 'setSign', title: '账单类型', width: 120, sort: 'true'}
            /* , {field: 'STATE', event: 'setSign', title: '账单状态', width: 120}*/
            , {field: 'TOTAL_PRICE', event: 'setSign', title: '账单金额', width: 120, align: 'right',sort: 'true'}
            , {field: 'PAY_DATE', event: 'setSign', title: '应收租日', width: 120, sort: 'true'}
            , {field: 'ALLOT_BILL', event: 'setSign', title: '收费类型', align: 'center', width: 120, sort: 'true'}
            , {field: 'IF_COLLECTION', event: 'setSign', title: '自动扣款', align: 'center', width: 120, sort: 'true',templet: '#COLLECTION'}
            , {field: 'COLLECTION_STATE', event: 'setSign', title: '扣款状态', align: 'center', width: 120, sort: 'true'}
            , {field: 'MAKE_BILL_TYPE', event: 'setSign', title: '生成类型', align: 'center', width: 120}
            , {field: 'STATE', event: 'setSign', title: '账单状态', align: 'center', width: 120, sort: 'true'}
            , {field: 'INFO', event: 'setSign', title: '备注', width: 120}
            , {fixed: 'right', width: 200, align: 'center', title: '操作', toolbar: '#dclbar'}

        ]]

        , id: 'szlbID'
        , page: true
        , width: 'full'
        , height:"470"
        , maxHeight:600
        , limit: '10'
        , footer:true
        , done: function(res, curr, count){
            var total=0;
            for(var i=0;i<res.data.length;i++){
                total+=parseFloat(res.data[i].TOTAL_PRICE);
            }
            $(".total_price").remove();
            // $(".layui-table-body").append('<div class="layui-table-foot" style="overflow: hidden;"><table cellspacing="0" cellpadding="0" border="0" class="layui-table"><tfoot><tr id="totalData" class="tr_sum"><td><div class="layui-table-cell laytable-cell-10003-item1"><span>账单汇总：</span></div></td><td><div class="layui-table-cell laytable-cell-10003-BUILDING_NAME"><span>' + total.toFixed(2)+'</span></div></td></tr></tfoot></table></div>');
             $(".layui-table-page").append('<span class="total_price" style="height: 10px;margin:10px 10px 0px 30px"><span>账单金额汇总：' + total.toFixed(2)+'元</span></span>');

        }
    });



    //自用账单    查看
    table.on('tool(ziyongf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var type;
        //自用账单标识问题 为了查看不显示 实际收款
        var hideShoukuan = "1";
        var payment_logo; // 1  支出  0 收费
        if(!data.TOTAL_PRICE.indexOf("-")){//应付账单标识
            payment_logo=1;
        }
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?payment_logo='+escape(payment_logo)+'&hd=' + escape(hideShoukuan) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'xiugai') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&type=' + escape(nametype) + '&button=edit&BILL_ID=' + data.ID + ''  //iframe的url
            });

        }
    });
    //待处理账单   查看 监听工具条 查看查看查看
    table.on('tool(szlbf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var type;
        var ROOM_NUM = data.ROOM_NUM;
        var hideShoukuan = "1";
        //有滞纳金标识
        var LATE_FEE = data.LATE_FEE;
        var isLATE = "";
        if ("-" == LATE_FEE) {
            isLATE = 0;
        } else {
            isLATE = LATE_FEE;
        }
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?hd=' + escape(hideShoukuan) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'dclsf') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '收费',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/charge.html?isLATE=' + isLATE + '&roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
        else if (layEvent === 'editbill') {
            //判断 是0租金  1  物业费2 等 传给修改页面 是否显示 物业 或者 租金
            var nametype = data.BILL_NAME;
            var type;
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '修改账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&type=' + escape(nametype) + '&button=edit&BILL_ID=' + data.ID + '' //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
        else if (layEvent === 'print') {
            print(data.ID);
        }
    });
    //已处理 已收 账单   查看
    table.on('tool(yichulif)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var type;
        var jymx = "1";//为了显示 已收账单的交易明细
        if (layEvent === 'detail') {
            if("停车费"==data.BILL_NAME){
                parent.layer.open({
                    zIndex: 1000,
                    type: 2,    //弹出类型
                    title: '查看账单',   //标题
                    closeBtn: 1,    //显示关闭按钮
                    shade: [0.3],   //遮罩透明度
                    area: ['80%', '90%'],  //打开窗口的宽高
                    time: 0,    //几秒后自动关闭，默认0时不关闭
                    anim: 1,    //动画效果
                    resize: false,  //设置成不允许拉伸
                    content: '../../../webhtml/contract/Parking_charges.html?&jymx=' + escape(jymx) + '&&type=' + escape(nametype) + '&button=1&BILL_ID=' + data.ID + ''  //iframe的url
                });
            }else {
                parent.layer.open({
                    zIndex: 1000,
                    type: 2,    //弹出类型
                    title: '查看账单',   //标题
                    closeBtn: 1,    //显示关闭按钮
                    shade: [0.3],   //遮罩透明度
                    area: ['80%', '90%'],  //打开窗口的宽高
                    time: 0,    //几秒后自动关闭，默认0时不关闭
                    anim: 1,    //动画效果
                    resize: false,  //设置成不允许拉伸
                    content: '../../../webhtml/contract/bill_check.html?&jymx=' + escape(jymx) + '&&type=' + escape(nametype) + '&button=1&BILL_ID=' + data.ID + ''  //iframe的url
                });
            }

        } else if (layEvent === 'yclbar') {

        }
    });
    //应付  账单   查看
    table.on('tool(yingfuf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var ROOM_NUM = data.ROOM_NUM;
        var type;
        //var jymx="1";//为了显示 已收账单的交易明细
        var FIX_PRICE=1;
        var payment_logo=1; // 1  支出  0 收费
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '支付',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?payment_logo=' + escape(payment_logo) + '&type=' + escape(nametype) + '&button=1&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'yingfu') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '支付',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/charge.html?payment_logo=' + escape(payment_logo) + '&FIX_PRICE=' + escape(FIX_PRICE) + '&roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
    });
    //逾期 账单   查看
    table.on('tool(yuqif)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var ROOM_NUM = data.ROOM_NUM;
        //有滞纳金标识
        var LATE_FEE = data.LATE_FEE;
        var isLATE = "";
        if ("-" == LATE_FEE) {
            isLATE = 0;
        } else {
            isLATE = LATE_FEE;
        }
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?isLATE=' + isLATE + '&roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'yuqisf') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '收费',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/charge.html?roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&isLATE=' + isLATE + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        } else if (layEvent === 'update') {
            var nametype = data.BILL_NAME;
            var type;
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '修改账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&isLATE=' + isLATE + '&type=' + escape(nametype) + '&button=edit&BILL_ID=' + data.ID + '' //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        } else if (layEvent === 'print') {
            print(data.ID);
        }
    });
    //审批 账单   查看
    table.on('tool(shenpif)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var payment_logo; // 1  支出  0 收费
        if(!data.TOTAL_PRICE.indexOf("-")){//应付账单标识
            payment_logo=1;
        }
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?payment_logo='+escape(payment_logo)+'&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'editbill') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '修改账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?payment_logo='+escape(payment_logo)+'&type=' + escape(nametype) + '&button=edit&BILL_ID=' + data.ID + '' //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }else if(layEvent === 'cancel'){
            layer.confirm('确定取消审核中的账单？', {
                btn: ['确定', '取消'], //按钮
                icon: 3
            }, function(){
                $.ajax({
                    url: "/billController/cancelShenpi",
                    data: {ID: data.id},
                    dataType: "json",
                    type: "post",
                    async: false,
                    success: function (res) {
                        if (res.errcode === "0") {
                            table.reload("shenpiID", {});
                            reloadspTbale();
                            layer.msg("已取消", {offset: '150px'});
                        } else if (res.errcode === "1") {
                            layer.msg(res.errmsg, function () {
                            });
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        console.error(XMLHttpRequest.status);
                        console.error(XMLHttpRequest.readyState);
                        console.error(textStatus);
                    }
                });
            }, function(){
                // layer.msg("已取消", {offset: '150px'});
            });
        }
    });
    //流水明细 账单   查看
    table.on('tool(lsmxf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var type;
        var jymx = "1";
        var Hidden_note="1";
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&Hidden_note=' + escape(Hidden_note) + '&&jymx=' + escape(jymx) + '&type=' + escape(nametype) + '&button=1&BILL_ID=' + data.BILL_ID + ''  //iframe的url
            });
        } else if (layEvent === 'yclbar') {

        }
    });



    //查询 已收账单
    $('.operateTableys .ys').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATE").val();
        data.END_DATE = $("#END_DATE").val();
        data.COMPANY_NAME = $("#COMPANY_NAME").val();
        data.BILL_NAME = $("#BILL_NAME").val();
        data.BYNAME = $("#BYNAME").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICE").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICE_STA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICE_END").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('yclID', {
            where: data
        });
    });
    //查询 应付账单
    $('.operateTableyf .yf').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEyf").val();
        data.END_DATE = $("#END_DATEyf").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEyf").val();
        data.BILL_NAME = $("#BILL_NAMEyf").val();
        data.BYNAME = $("#BYNAMEyf").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICEyf").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICEyfSTA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICEyfEND").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('yingfuID', {
            where: data
        });
    });
    //查询 未收账单
    $('.operateTablews .ws').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEw").val();
        data.END_DATE = $("#END_DATEw").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEw").val();
        data.BILL_NAME = $("#BILL_NAMEw").val();
        data.BYNAME = $("#BYNAMEw").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICEw").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICEwSTA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICEwEND").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        data.ALL_DATA = $("#ALL_DATA").val();
        table.reload('szlbID', {
            where: data
        });
    });
    //查询 逾期账单
    $('.operateTableyq .yq').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEy").val();
        data.END_DATE = $("#END_DATEy").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEy").val();
        data.BILL_NAME = $("#BILL_NAMEy").val();
        data.BYNAME = $("#BYNAMEy").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICEy").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICEySTA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICEyEND").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('yqlbID', {
            where: data
        });
    });
    //查询 自用账单
    $('.operateTablezy .zy').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEziy").val();
        data.END_DATE = $("#END_DATEziy").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICEzy").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICEzySTA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICEzyEND").val();
        data.BILL_NAME = $("#BILL_NAMEzy").val()
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('ZIYONG', {
            where: data
        });
    });
    //查询 流水 收入
    $('.operateTablesy .layui-btn').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEsy").val();
        data.END_DATE = $("#END_DATEsy").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEsy").val();
        data.BILL_NAME = $("#BILL_NAMEsy").val()
        data.BYNAME = $("#BYNAMEsy").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('shouruID', {
            where: data
        });
    });
    //查询 流水 支出
    $('.operateTablezc .layui-btn').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEzc").val();
        data.END_DATE = $("#END_DATEzc").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEzc").val();
        data.BILL_NAME = $("#BILL_NAMEzc").val()
        data.BYNAME = $("#BYNAMEzc").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('zhichuID', {
            where: data
        });
    });
    //查询 审批账单
    $('.operateTablespzd .spzd').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEspzd").val();
        data.END_DATE = $("#END_DATEspzd").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEspzd").val();
        data.BILL_NAME = $("#BILL_NAMEspzd").val()
        data.BYNAME = $("#BYNAMEspzd").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('shenpiID', {
            where: data
        });
    });



    //退租结算 操作
    //待处理账单   查看 监听工具条 查看查看查看
    table.on('tool(tzjsf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var ROOM_NUM = data.ROOM_NUM;
        if (layEvent === 'detail') {
            var type;
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'tzjssf') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '收费',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/charge.html?roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
        else if (layEvent === 'editbill') {
            //判断 是0租金  1  物业费2 等 传给修改页面 是否显示 物业 或者 租金
            var nametype = data.BILL_NAME;
            var type;
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '修改账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?&type=' + escape(nametype) + '&button=edit&BILL_ID=' + data.ID + '' //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
    });
    //查询 收入预算
    $('.operateTablesyys .layui-btn').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEsyys").val();
        data.END_DATE = $("#END_DATEsyys").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEsyys").val();
        data.BILL_NAME = $("#BILL_NAMEsyys").val()
        data.BYNAME = $("#BYNAMEsyys").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('shouruyusuanID', {
            where: data
        });
    });
    //查询 退租结算
    $('.operateTabletzjs .layui-btn').on('click', function () {
        var data = {};
        data.START_DATE = $("#START_DATEtzjs").val();
        data.END_DATE = $("#END_DATEtzjs").val();
        data.COMPANY_NAME = $("#COMPANY_NAMEtzjs").val();
        data.BILL_NAME = $("#BILL_NAMEtzjs").val();
        data.TOTAL_PRICE = $("#TOTAL_PRICEtzjs").val();
        data.TOTAL_PRICE_STA = $("#TOTAL_PRICEtzjsSTA").val();
        data.TOTAL_PRICE_END = $("#TOTAL_PRICEtzjsEND").val();
        data.BYNAME = $("#BYNAMEtzjs").val();
        data.BUILDING_ID = BUILDING_ID;
        data.BUSINESS_ID = BUSINESS_ID;
        table.reload('tzjsid', {
            where: data
        });
    });
    //收入预算 查看
    table.on('tool(srysf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        var ROOM_NUM = data.ROOM_NUM;
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === 'sryssf') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '收费',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/charge.html?roomnum=' + escape(ROOM_NUM) + '&type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
            $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
        }
    });
    //支出 查看
    table.on('tool(zcf)', function (obj) {
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值
        var nametype = data.BILL_NAME;
        if (layEvent === 'detail') {
            parent.layer.open({
                zIndex: 1000,
                type: 2,    //弹出类型
                title: '查看账单',   //标题
                closeBtn: 1,    //显示关闭按钮
                shade: [0.3],   //遮罩透明度
                area: ['80%', '90%'],  //打开窗口的宽高
                time: 0,    //几秒后自动关闭，默认0时不关闭
                anim: 1,    //动画效果
                resize: false,  //设置成不允许拉伸
                content: '../../../webhtml/contract/bill_check.html?type=' + escape(nametype) + '&BILL_ID=' + data.ID + ''  //iframe的url
            });
        } else if (layEvent === '') {

        }
    });
    //增加一个账单
    $(".bill_add").click(function () {
        parent.layer.open({
            zIndex: 1000,
            type: 2,    //弹出类型
            title: '添加账单',   //标题
            closeBtn: 1,    //显示关闭按钮
            shade: [0.3],   //遮罩透明度
            area: ['1000px', '90%'],  //打开窗口的宽高
            time: 0,    //几秒后自动关闭，默认0时不关闭
            anim: 1,    //动画效果
            resize: false,  //设置成不允许拉
            content: '../../../webhtml/contract/bill_add.html?ROOM_ID='  //iframe的url
        });
        $(this).blur(); //移除焦点，防止点击回车按钮造成多次打开
    });

    //切换金额搜索 区间 和 等值金额
    $(".qiehuanjine").click(function () {

    });
    //监听 切换金额搜索 区间 和 等值金额
    $('.qiehuanw').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjinew").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEw\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjinew").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEwSTA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEwEND\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    });
    $('.qiehuan').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjine").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICE\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjine").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICE_STA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICE_END\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    })
    $('.qiehuany').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjiney").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEy\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjiney").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEySTA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICE\" id=\"TOTAL_PRICEyEND\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    })
    $('.qiehuanzy').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjinezy").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICEzy\" id=\"TOTAL_PRICEzy\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjinezy").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEzySTA\" id=\"TOTAL_PRICEzySTA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEzyEND\" id=\"TOTAL_PRICEzyEND\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    })
    $('.qiehuanyf').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjineyf").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICEyf\" id=\"TOTAL_PRICEyf\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjineyf").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEyfSTA\" id=\"TOTAL_PRICEyfSTA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEyfEND\" id=\"TOTAL_PRICEyfEND\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    })
    $('.qiehuantzjs').change(function () {
        if ("0" == $(this).children('option:selected').val()) {
            //固定金额
            $(".qiehuanjinetzjs").html("<div class=\"layui-inline\">\n" +
                "                                <input class=\"layui-input\" name=\"TOTAL_PRICEtzjs\" id=\"TOTAL_PRICEtzjs\" placeholder=\"金额\" >\n" +
                "                            </div>");
        }
        if ("1" == $(this).children('option:selected').val()) {
            $(".qiehuanjinetzjs").html("<div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEtzjsSTA\" id=\"TOTAL_PRICEtzjsSTA\" placeholder=\"最小值\" >\n" +
                "                                </div>\n" +
                "                                <div class=\"layui-inline jinebox\">\n" +
                "                                    <input class=\"layui-input\" name=\"TOTAL_PRICEtzjsEND\" id=\"TOTAL_PRICEtzjsEND\" placeholder=\"最大值\" >\n" +
                "                                </div>");
        }
    })
    //收租列表批量收费
    $(".plsf").click(function () {
        var data = table.checkStatus('szlbID').data;
        opera.PLSF(data);

    });
    //逾期批量收费
    $(".YUQIplsf").click(function () {
        var data = table.checkStatus('yqlbID').data;
        opera.PLSF(data);
    });
    var opera={
        //收租列表 逾期 批量
        PLSF:function (data) {
            var pd = initDatas(data);
            var data = {};
            data.BILL_ID = pd;
            layer.msg('确定批量收费？', {
                time: 20000, //20s后自动关闭
                btn: ['确定', '取消',]
                , yes: function (index) {
                    layer.close(index); // 关闭当前提示框
                    $.ajax({
                        url: "/billController/savebillpayALL",
                        data: data,
                        dataType: "json",
                        type: "post",
                        async: false,
                        success: function (res) {
                            if (res.errcode === "0") {
                                var i = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(i);  // 关闭修改房间页面
                                parent.layer.msg("批量收款成功", {offset: '150px'});   // 父页面弹出修改成功

                            } else if (res.errcode === "1") {
                                layer.msg(res.errmsg, function () {
                                });
                            }
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            console.error(XMLHttpRequest.status);
                            console.error(XMLHttpRequest.readyState);
                            console.error(textStatus);
                        }
                    });
                    reloadszTbale();//刷新收租列表
                    reloadyqlbTbale();//刷新逾期列表
                }
            });
        }
    }
    //打印凭证-应收
    $(".plsf-ys").click(function () {
        var data = table.checkStatus('szlbID').data;
        var pd = initDatas(data);
        print(pd);
    });
    //打印凭证-逾期
    $(".plsf-yq").click(function () {
        var data = table.checkStatus('yqlbID').data;
        var pd = initDatas(data);
        print(pd);
    });

    // 打印凭证
    function print(ids) {
        if (!ids) {
            layer.alert("至少选择一个账单");
            return false;
        } else {
            ids = ids.replace(/(.*)[,，]$/, '$1');
            layer.open({
                type: 2,
                title: '打印凭证',
                shadeClose: false,
                shade: [0.3],
                maxmin: true, //开启最大化最小化按钮
                area: ['100%', '100%'],
                scrollbar: false, //屏蔽滚动条
                content: './../contract/contract_print.html?type=1&id=' + ids
            });
        }
    }

    //批量生成账单封装数据id
    function initDatas(data) {
        var rs;
        $.each(data, function (i, info) {
            if (i == 0) {
                rs = info.ID + ",";
            } else {
                rs += "" + info.ID + ",";
            }

        })
        return rs;
    }

    //加载所有搜索下拉框账单类型值
    $.ajax({
        url: "/property/propertyListALL/",
        dataType: "json",
        type: "post",
        async: false,
        success: function (res) {
            if (res.errcode === "0") {
                for (var i = 0; i < res.data.length; i++) {
                    $("#BILL_NAMEw").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAME").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEy").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEzy").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEsy").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEsyys").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEyf").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEtzjs").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEzc").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                    $("#BILL_NAMEspzd").append("<option value=" + res.data[i].CODE + ">" + res.data[i].CODE + "</option>");
                }
            } else if (res.errcode === "1") {
                layer.msg(res.errmsg, function () {
                });
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.error(XMLHttpRequest.status);
            console.error(XMLHttpRequest.readyState);
            console.error(textStatus);
        }
    });
    //加载 统计信息 收入支出 和 收入支出差
    $.ajax({
        url: "/property/propertyListALL/",
        dataType: "json",
        type: "post",
        async: false,
        success: function (res) {
            if (res.errcode === "0") {
            } else if (res.errcode === "1") {
                layer.msg(res.errmsg, function () {
                });
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.error(XMLHttpRequest.status);
            console.error(XMLHttpRequest.readyState);
            console.error(textStatus);
        }
    });
});

//提交收款后 刷新table
function reloadszTbale() {
    table.reload("szlbID", {});
}
//刷新 审批账单
function reloadspTbale() {
    table.reload("shenpiID", {});
}
function reloadtzTbale() {
    table.reload("tzjsid", {});
}
function reloadyfTbale() {
    table.reload("yingfuID", {});
}
function reloadyclTbale() {
    table.reload("yclID", {});
}
function reloadyqlbTbale() {
    table.reload("yqlbID", {});
}
function reloadzclbTbale() {
    table.reload("zhichuID", {});
}
function reloadzylbTbale() {
    table.reload("ZIYONG", {});
}
function reloadsylbTbale() {
    table.reload("shouruID", {});
}
//收入预算
function reloadsyysTbale() {
    table.reload("shouruyusuanID", {});
}

// 导出excel 应收
function excel() {
    var data = {};
    data.START_DATE = $("#START_DATEw").val();
    data.END_DATE = $("#END_DATEw").val();
    data.COMPANY_NAME = $("#COMPANY_NAMEw").val();
    data.BILL_NAME = $("#BILL_NAMEw").val();
    data.BYNAME = $("#BYNAMEw").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEw").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEwSTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEwEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data.ALL_DATA = $("#ALL_DATA").val();
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel?DATA=" + data);

}
// 导出excel 已收
function excel_yichuli() {
    var data = {};
    data.START_DATE = $("#START_DATE").val();
    data.END_DATE = $("#END_DATE").val();
    data.COMPANY_NAME = $("#COMPANY_NAME").val();
    data.BILL_NAME = $("#BILL_NAME").val();
    data.BYNAME = $("#BYNAME").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICE").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICE_STA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICE_END").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_yichuli?DATA=" + data);
}

// 导出excel 应付
function excel_yingfu() {
    var data = {};
    data.START_DATE = $("#START_DATEyf").val();
    data.END_DATE = $("#END_DATEyf").val();
    data.COMPANY_NAME = $("#COMPANY_NAMEyf").val();
    data.BILL_NAME = $("#BILL_NAMEyf").val();
    data.BYNAME = $("#BYNAMEyf").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEyf").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEyfSTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEyfEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_yingfu?DATA=" + data);

}

// 导出excel 应付
function excel_yuqi() {
    var data = {};
    data.START_DATE = $("#START_DATEy").val();
    data.END_DATE = $("#END_DATEy").val();
    data.COMPANY_NAME = $("#COMPANY_NAMEy").val();
    data.BILL_NAME = $("#BILL_NAMEy").val();
    data.BYNAME = $("#BYNAMy").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEy").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEySTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEyEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_yuqi?DATA=" + data);

}

// 导出excel 自用
function excel_ziyong() {
    var data = {};
    data.START_DATE = $("#START_DATEziy").val();
    data.END_DATE = $("#END_DATEziy").val();
    data.BILL_NAME = $("#BILL_NAMEzy").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEzy").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEzySTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEzyEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_ziyong?DATA=" + data);

}
// 导出excel 收入
function excel_shouru() {
    var data = {};
    data.START_DATE = $("#START_DATEziy").val();
    data.END_DATE = $("#END_DATEziy").val();
    data.BILL_NAME = $("#BILL_NAMEzy").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEzy").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEzySTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEzyEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_shouru?DATA=" + data);

}
// 导出excel 支出
function excel_zhichu() {
    var data = {};
    data.START_DATE = $("#START_DATEzc").val();
    data.END_DATE = $("#END_DATEzc").val();
    data.BILL_NAME = $("#BILL_NAMEzc").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEzc").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEzcSTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEzcEND").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_zhichu?DATA=" + data);

}
// 导出excel 收入预算
function excel_srys() {
    var data = {};
    data.COMPANY_NAME = $("#COMPANY_NAMEsyys").val();
    data.BYNAME = $("#BYNAMEsyys").val();
    data.START_DATE = $("#START_DATEsyys").val();
    data.END_DATE = $("#END_DATEsyys").val();
    data.BILL_NAME = $("#BILL_NAMEsyys").val()
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_srys?DATA=" + data);

}
// 导出excel 退租结算
function excel_tzjs() {
    var data = {};
    data.COMPANY_NAME = $("#COMPANY_NAMEtzjs").val();
    data.BYNAME = $("#BYNAMEtzjs").val();
    data.START_DATE = $("#START_DATEtzjs").val();
    data.END_DATE = $("#END_DATEtzjs").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEtzjs").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEtzjsSTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEtzjsEND").val();
    data.BILL_NAME = $("#BILL_NAMEtzjs").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_tzjs?DATA=" + data);
}
// 导出excel 退租结算
function excel_spzd() {
    var data = {};
    data.COMPANY_NAME = $("#COMPANY_NAMEspzd").val();
    data.BYNAME = $("#BYNAMEspzd").val();
    data.START_DATE = $("#START_DATEspzd").val();
    data.END_DATE = $("#END_DATEspzds").val();
    data.TOTAL_PRICE = $("#TOTAL_PRICEspzd").val();
    data.TOTAL_PRICE_STA = $("#TOTAL_PRICEspzdSTA").val();
    data.TOTAL_PRICE_END = $("#TOTAL_PRICEspzdEND").val();
    data.BILL_NAME = $("#BILL_NAMEspzd").val();
    data.BUILDING_ID = BUILDING_ID;
    data.BUSINESS_ID = BUSINESS_ID;
    data = JSON.stringify(data);
    data=data.replace("{","[");
    data=data.replace("}","]");
    window.open("/billController/excel_spzd?DATA=" + data);
}

